<template>
	<view class="container">
		<cu-custom bgColor="bg-gradual-orange" :isBack="true">
			<block slot="content">物流信息</block>
		</cu-custom>
		<view class="content">
			<view class="header">
				<view class="info">
					<view class="logo-container">
						<image :src="result.logo" class="logo"></image>
					</view>
					<view class="details">
						<text class="title">{{ result.expName }}</text>
						<text class="tracking-number">运单号: {{ result.number }}</text>
					</view>
				</view>

				<text class="status">最新状态: {{ result.list[0].status }}</text>
				<view class="update-container">
					<text class="update-time">更新时间: {{ result.updateTime }}</text>
				</view>
				<view class="take-time-container">
					<text class="take-time">耗时: {{ result.takeTime }}</text>
				</view>
			</view>
			<view class="list">
				<text class="list-title">物流信息</text>
				<view v-for="(item, index) in result.list" :key="index" class="list-item">

					<view class="content">
						<view>

							<text class="time">{{ item.time }}</text>
						</view>
						<view>
							<text class="status">{{ item.status }}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	import banlance from '@/api/banlance';
	export default {
		data() {
			return {
				number: '',
				result: {
				}
			};
		},
		onLoad(options) {
			this.number = options.no
			if (this.number) {
				this.wuliu(this.number)
			}
		},
		methods: {
			async wuliu(no) {
				const res = await banlance.wuliu({
					no: no
				});
				this.result = res.result
				console.log(this.result)
			}
		}
	};
</script>

<style scoped>
	.content {
		padding: 20px;
	}

	.update-container {
		margin-top: 5px;
		/* 添加间距 */
	}

	.take-time-container {
		margin-top: 5px;
		/* 添加间距 */
	}

	.container {
		/* padding: 20px; */
		background-color: #f5f5f5;
	}

	.header {
		margin-bottom: 20px;
	}

	.info {
		display: flex;
		align-items: flex-start;
		margin-bottom: 15px;
	}

	.logo-container {
		flex-shrink: 0;
		margin-right: 10px;
	}

	.logo {
		width: 80px;
		height: 80px;
	}

	.details {
		display: flex;
		flex-direction: column;
	}

	.title {
		font-size: 20px;
		font-weight: bold;
	}

	.tracking-number {
		margin-top: 5px;
		color: #666;
	}

	.status,
	.update-time,
	.take-time {
		color: #666;
		margin-top: 5px;
	}

	.list {
		background-color: #fff;
		padding: 15px;
		border-radius: 8px;
	}

	.list-title {
		font-size: 18px;
		font-weight: bold;
		margin-bottom: 15px;
	}

	.list-item {
		display: flex;
		position: relative;
		/* padding-left: 30px; */
		/* margin-bottom: 20px; */
	}

	.timeline {
		position: absolute;
		left: 0;
		top: 5px;
	}

	.circle {
		width: 10px;
		height: 10px;
		background-color: #3498db;
		border-radius: 50%;
	}

	.line {
		width: 2px;
		background-color: #3498db;
		height: 100%;
		margin-left: 4px;
		position: relative;
		top: 10px;
	}

	.content {
		margin-left: 10px;
	}

	.time {
		font-size: 14px;
		color: #999;
	}

	.status {
		font-size: 16px;
		color: #333;
		margin-top: 5px;
	}
</style>